package WaiBao;

import java.util.Arrays;

public class ChuZhenWang {
    public static void main(String[] args) {
        String[] name = {"高小喵(班长)", "王酒鬼(副班长)", "小李(学习委员)", "王马(文艺委员)", "高见鸿", "王甜", "王凯", "杨茶", "幻想曲", "王道", "王东", "张坤",
                "王效率", "谭八爷", "胖哥俩", "裴东来", "王行", "李可", "刘昊然", "王宝强", "李大总", "张苞", "汪帮主", "懒洋洋", "赵淼", "罗翔", "李遂", "王俊杰",
                "谢霆锋", "褚臻旺(学生)"};//考生本人:褚臻旺(学生)
        int[] age = {20, 20, 20, 20, 21, 20, 19, 18, 21, 21, 18, 18, 21, 21, 20, 20, 18, 18, 18, 18, 19, 20, 20, 20, 21, 18, 20, 18, 20, 22};//考生本人年龄:22

        double[] digital1 = {87, 76, 81, 84, 86, 64, 78, 84, 81, 71, 76, 85, 75, 71, 76, 78, 64, 90, 74, 84, 73, 91, 75, 81, 78, 73, 81, 66, 60, 89};
        double[] digital2 = {69, 77, 85, 84, 84, 84, 76, 74, 77, 84, 85, 78, 87, 74, 85, 64, 71, 74, 75, 68, 85, 62, 65, 81, 74, 85, 75, 76, 75, 85};
        double[] digital3 = {77, 73, 75, 85, 78, 66, 74, 81, 84, 67, 63, 81, 85, 72, 68, 60, 88, 67, 66, 74, 92, 81, 91, 65, 89, 78, 74, 62, 74, 83};


        double xiangyue1;//代表每个学生的总分
        double xiangyue2;//代表每个学生的平均分
//            for (int i = 0; i < 30; i++) {
//                xiangyue1 =digital1[i] +digital2[i] +digital3[i];
//                xiangyue2 = ( xiangyue1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + xiangyue1);
//            System.out.println(name[i] + "的平均分为:" +xiangyue2);
//        }

        double qiulun1 = 0,qiulun2 = 0;
        double[] wuqi = new double[30];
//        for (int i = 0; i < 30; i++) {
//            qiulun1 =  digital1[i] +  digital2[i] + digital3[i];
//            qiulun2 = (qiulun1 * 1.0) / 3;
//            wuqi[i] =qiulun2;
//        }
//
//        for (int i = 0; i <wuqi.length - 1; i++) {
//            for (int j = 0; j < wuqi.length - i - 1; j++) {
//                if (wuqi[j] <wuqi[j + 1]) {
//                    double tep = wuqi[j];
//                    wuqi[j] = wuqi[j + 1];
//                    wuqi[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(wuqi[i]);
//        }

        double shiping1 = 0,shiping2 = 0,shiping3 = 0;//计算每门课的平均分
        double madong1 = 0,madong2 = 0,madong3 = 0;//计算每门课标准差
        double danjie1 = 0,danjie2 = 0,danjie3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <digital1.length; i++) {
            sum2+=digital1[i];
        }
        shiping1 = (sum2*1.0)/30;
        System.out.println("分析化学的班级平均分为:"+shiping1);
        double Sum = 0;
        for (int i = 0; i <digital2.length; i++) {
            Sum+=digital2[i];
        }
        shiping2 = (Sum*1.0)/30;
        System.out.println("线性代数学的班级平均分为:"+shiping2);
        double sum = 0;
        for (int i = 0; i <digital3.length; i++) {
            sum+=digital3[i];
        }
        shiping3 = (sum*1.0)/30;
        System.out.println("有机化学的班级平均分为:"+shiping3);


////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <digital1.length; i++) {
            c1+= (digital1[i] -shiping1)*(digital1[i] -shiping1);
        }
        madong1 = Math.sqrt(c1*1.0/30);
        System.out.println("分析化学的班级标准差为:"+madong1);

        for (int i = 0; i <digital2.length; i++) {
            c2+= (digital2[i] -shiping2)*(digital2[i] -shiping2);
        }
        madong2 = Math.sqrt(c2*1.0/30);
        System.out.println("线性代数的班级标准差为:"+madong2);

        for (int i = 0; i <digital3.length; i++) {
            c3+= (digital3[i] -shiping3)*(digital3[i] -shiping3);
        }
        madong3 = Math.sqrt(c3*1.0/30);
        System.out.println("有机化学的班级标准差为:"+madong3);
////////////////////////////
////////////////////////////
        Arrays.sort(digital1);
        Arrays.sort(digital2);
        Arrays.sort(digital3);
        danjie1 =(digital1[14]+digital1[15])*1.0/2;
        danjie2 =(digital2[14]+digital2[15])*1.0/2;
        danjie3 =(digital3[14]+digital3[15])*1.0/2;
        System.out.println("分析化学的中位数为:"+danjie1);
        System.out.println("线性代数的中位数为:"+danjie2);
        System.out.println("有机化学的中位数为:"+danjie3);




    }
}
